package cn.iocoder.yudao.module.project.dal.mysql.constructionunit;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.project.dal.dataobject.constructionunit.ConstructionUnitDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.project.controller.admin.constructionunit.vo.*;

/**
 * 施工单位 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ConstructionUnitMapper extends BaseMapperX<ConstructionUnitDO> {

    default List<ConstructionUnitDO> selectList(Collection<Long> ids, Collection<Integer> statuses) {
        return selectList(new LambdaQueryWrapperX<ConstructionUnitDO>()
                .inIfPresent(ConstructionUnitDO::getId, ids)
                .inIfPresent(ConstructionUnitDO::getStatus, statuses));
    }

    default PageResult<ConstructionUnitDO> selectPage(ConstructionUnitPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ConstructionUnitDO>()
                .likeIfPresent(ConstructionUnitDO::getName, reqVO.getName())
                .eqIfPresent(ConstructionUnitDO::getCorporation, reqVO.getCorporation())
                .eqIfPresent(ConstructionUnitDO::getDescription, reqVO.getDescription())
                .eqIfPresent(ConstructionUnitDO::getContact, reqVO.getContact())
                .eqIfPresent(ConstructionUnitDO::getContactPhone, reqVO.getContactPhone())
                .eqIfPresent(ConstructionUnitDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ConstructionUnitDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ConstructionUnitDO::getId));
    }

}